<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>vue_demo2</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
    <h1>vue_demo2</h1>
    <hr/>
    <div id="app-1">
        <p>{{ msg }}</p>
        <input v-model="msg"/>
    </div>
<script>
    var app1 = new Vue({
        el: '#app-1',
        data: {
            msg: "msg1"
        },
        watch: {
            msg(newValue, oldValue) {
                console.log("new:" + newValue);
                console.log("old:" + oldValue)
            }
        }
    })
</script>
</body>
</html>